Add canonical links for documentation pages#329
Open
danielh-official wants to merge 1 commit intoNativePHP:mainfrom
Open
Add canonical links for documentation pages#329danielh-official wants to merge 1 commit intoNativePHP:mainfrom
danielh-official wants to merge 1 commit intoNativePHP:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Search engines and AI (like Google Gemini) usually apply a larger weight to content based on how long it's been around.
This can mean that old and deprecated documentation can be pushed to the forefront when a developer searches for an answer on how to do XYZ with NativePHP (especially if he or she doesn't specify the version number of the documentation).
Adding a canonical link to the head of each documentation page informs the search engine of the latest version of that page to use, pushing its content to the forefront, regardless of how long it's been around.
For reference, Laravel documentation inserts a canonical link for its pages.
e.g., https://laravel.com/docs/13.x/starter-kits has
<link rel="canonical" href="https://laravel.com/docs/13.x/starter-kits" data-inertia="canonical">This change adds canonical links for each version of each documentation page, pointing to the latest version of that page.
e.g., https://nativephp.com/docs/mobile/2/getting-started/introduction would have a canonical link like so:
<link rel="canonical" href="https://nativephp.com/docs/mobile/3/getting-started/introduction">The idea is that the LLM crawler would see the canonical link and know to use the content for version 3 of that page if a developer doesn't explicitly state he or she wants version 1 or 2 of the documentation.
Some Exceptions
If the latest version of that page doesn't exist, it resolves to the latest version of the home documentation page, which is
getting-started/introductionfor both platforms.Also, if on the v1 or v2 versions of the "APIs" pages for the mobile platform, the canonical link resolves them to the "plugins/core" of the latest version.
This logic is taken from the
resources/views/components/docs/old-version-notice.blade.phpfile.